package control

import (
	"github.com/hyperledger/fabric/core/chaincode/shim"
	"github.com/hyperledger/fabric/protos/peer"
	"encoding/json"
	"canliancontract/log"
	"canliancontract/service"
)

/**
* 上链
**/
func (t *CanlianTrace) Register(stub shim.ChaincodeStubInterface, args []string) peer.Response {
	log.Logger.Info("##############上链接口开始###############")
	if len(args) < 1 {
		return shim.Error("参数不对，请核实参数信息。" )
	}
	var paramList []interface{}
	err := json.Unmarshal([]byte(args[0]), &paramList)
	if err != nil {
		return shim.Error("err:" + err.Error())
	}
	return service.Register(stub, paramList)
}

